/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.testis.gui.mvc.model.testbed;

import org.testis.gui.mvc.controller.testbed.DeviceGroupController;
import org.testis.gui.mvc.controller.testbed.DeviceGroupController;
import org.testis.gui.mvc.model.AbstractModel;

/**
 *
 * @author selcuk
 */
public class DeviceGroupModel extends AbstractModel {

    private Integer m_deviceGroupId = 0;
    private String m_name = "";
    private Boolean m_isActive = false;
    private String m_lastError = "";
    private Boolean m_visibility = false;

    public void setVisibility(Boolean val) {
        if (val == null) {
            return;
        }
        Boolean oldVal = m_visibility;
        m_visibility = val;
        firePropertyChange(DeviceGroupController.VISIBLE_PROPERTY,
                oldVal,
                val);
    }

    public Boolean getVisibility() {
        return m_visibility;
    }

    public String getName() {
        return m_name;
    }

    public void setName(String name) {
        if (name == null) {
            name = "";
        }
        String oldName = m_name;
        m_name = name;
        firePropertyChange(DeviceGroupController.NAME_PROPERTY,
                oldName,
                name);
    }

    public String getLastError() {
        return m_lastError;
    }

    public void setLastError(String val) {
        if (val == null) {
            val = "";
        }
        String oldValue = m_lastError;
        m_lastError = val;
        firePropertyChange(DeviceGroupController.ERROR_PROPERTY, null,
                m_lastError);
    }

    /**
     * @return the m_deviceId
     */
    public Integer getDeviceGroupId() {
        return m_deviceGroupId;
    }

    /**
     * @param val the m_deviceId to set
     */
    public void setDeviceGroupId(Integer val) {
        if (val == null) {
            return;
        }
        Integer oldVal = m_deviceGroupId;
        this.m_deviceGroupId = val;
        firePropertyChange(DeviceGroupController.DEVICEGROUP_ID_PROPERTY,
                oldVal,
                val);
    }

    /**
     * @return the m_isActive
     */
    public Boolean getIsActive() {
        return m_isActive;
    }

    /**
     * @param val the m_isActive to set
     */
    public void setIsActive(Boolean val) {
        if (val == null) {
            return;
        }
        Boolean oldVal = m_isActive;
        this.m_isActive = val;
        firePropertyChange(DeviceGroupController.ACTIVE_PROPERTY,
                oldVal,
                val);
    }
}
